#ifndef _MIXP_CORE_CONFIG_H
#define _MIXP_CORE_CONFIG_H

#include <stdio.h>
#include <limits.h>
#if defined (__WIN32__) || defined (WIN32) || defined (_MSC_VER)
#include "gear-lib/libposix4win.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if defined (__WIN32__) || defined (WIN32) || defined (_MSC_VER)
#define PATH_MAX   4096
#endif
typedef struct mixp_config {
    struct mixp_config_ops *ops;
    char path[PATH_MAX];
    void *priv;
} mixp_config_t;

typedef struct mixp_config_ops {
    int (*load)(struct mixp_config *c, const char *name);
    char *(*get_string) (struct mixp_config *c, ...);
    int (*get_int)      (struct mixp_config *c, ...);
    double (*get_double)(struct mixp_config *c, ...);
    int (*get_boolean)  (struct mixp_config *c, ...);
    int (*get_length)   (struct mixp_config *c, ...);
    void (*unload)(struct mixp_config *c);
} mixp_config_ops_t;

extern struct mixp_config *g_config;

struct mixp_config *mixp_conf_load(const char *name);

#define mixp_conf_get_int(c, ...) g_config->ops->get_int(c, __VA_ARGS__, NULL)
#define mixp_conf_get_string(c, ...) g_config->ops->get_string(c, __VA_ARGS__, NULL)
#define mixp_conf_get_double(c, ...) g_config->ops->get_double(c, __VA_ARGS__, NULL)
#define mixp_conf_get_boolean(c, ...) g_config->ops->get_boolean(c, __VA_ARGS__, NULL)
#define mixp_conf_get_length(c, ...) g_config->ops->get_length(c, __VA_ARGS__, NULL)

void mixp_conf_unload(struct mixp_config *c);

#ifdef __cplusplus
};
#endif
#endif